//
//  MOWorkTaskSelectdTaskTypeCell.m
//  MobileOffice
//
//  Created by 冰冰 on 2019/8/12.
//  Copyright © 2019 com.idolmedia. All rights reserved.
//

#import "MOWorkTaskSelectdTaskTypeCell.h"

@interface MOWorkTaskSelectdTaskTypeCell ()

@property(nonatomic,strong)UILabel *nameLabel;

@property(nonatomic,strong)UIImageView *selectedImageView;

@end

@implementation MOWorkTaskSelectdTaskTypeCell

+(instancetype)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    //NSString *ID = [NSString stringWithFormat:@"Cell%ld%ld",(long)[indexPath section],(long)[indexPath row]];
    NSString *ID = @"MOWorkTaskSelectdTaskTypeCell";
    MOWorkTaskSelectdTaskTypeCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil){
        cell = [[MOWorkTaskSelectdTaskTypeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        [cell creatView];
    }
    return cell;
}


-(void)creatView
{
    [self addSubview:self.nameLabel];
    [self addSubview:self.selectedImageView];
}

-(void)setModel:(MOWorkTaskSelectdTaskTypeModel *)model
{
    self.nameLabel.text = model.nameStr;
    
    if ([model.selectedStatus integerValue]==1) {
        self.selectedImageView.image = IMAGE(@"taskSelectd");
    }else{
        self.selectedImageView.image = IMAGE(@"");
    }
}

#pragma mark --
-(UILabel *)nameLabel
{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH - 16 - 25 - 15, 46)];
        _nameLabel.font = FONT_SIZE(13);
        _nameLabel.textColor = KBlueColor_2C94FF;
    }
    return _nameLabel;
}

-(UIImageView *)selectedImageView
{
    if (!_selectedImageView) {
        _selectedImageView = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 21 - 13, 0, 15, 11)];
        _selectedImageView.centerY = _nameLabel.centerY;
    }
    return _selectedImageView;
}

@end
